package com.byb.server.service.mapper;



import com.byb.server.domain.Rate;
import com.byb.server.service.dto.Product_sort;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;
/**
 * Mapper for the entity Rate and its DTO Product_sort.
 */
@Mapper(componentModel = "spring", uses = {WordKeyMapper.class, })
public interface Product_sortMapper extends EntityMapper<Product_sort,Rate> {

    @Mapping(source = "product.id", target = "productId")
    @Mapping(source = "product.productName" ,target = "productName")
    @Mapping(source = "product.productImg" ,target = "productImg")
    @Mapping(source = "product.overallScore" ,target = "overallScore")
    @Mapping(source = "product.ensureScopeSocre" ,target = "ensureScopeSocre")
    @Mapping(source = "product.strichenNum" ,target = "strichenNum")
    @Mapping(source = "product.strichenClaimTimes" ,target = "strichenClaimTimes")
    @Mapping(source = "product.mildNum" ,target = "mildNum")
    @Mapping(source = "product.mildClaimTimes" ,target = "mildClaimTimes")
    @Mapping(source = "product.mildProbability" ,target = "mildProbability")
    @Mapping(source = "product.amountOfIndemnificationSocre",target = "amountOfIndemnificationSocre")
    @Mapping(source = "product.claimsSettlementSocre",target = "claimsSettlementSocre")
    @Mapping(source = "product.convenientServicetSocre",target = "convenientServicetSocre")
    @Mapping(source = "product.wordKeys" ,target = "wordKeys")
    Product_sort toDto(Rate rate);



    default Rate fromId(Long id) {
        if (id == null) {
            return null;
        }
        Rate rate = new Rate();
        rate.setId(id);
        return rate;
    }

}
